import {Injectable} from '@angular/core';
import {_HttpClient} from '@delon/theme';
import {Observable} from 'rxjs/Observable';
import {Jpush} from './jpush';

@Injectable()
export class JpushService {
    url_jpush_list = 'Jpush/allpush';
    url_jpush_add = 'Jpush/addjpush';
    url_jpush_del = 'Jpush/del';

    constructor(private  http: _HttpClient) {
    }


    getjpushlist(page: number): Observable<any> {
        return this.http.get(this.url_jpush_list, {page: page});
    }

    addjpush(item: Jpush): Observable<any> {
        return this.http.post(this.url_jpush_add, JSON.stringify(item));
    }

    deljpush(id: number): Observable<string> {
        return this.http.delete(this.url_jpush_del, {id: id});
    }
}
